import numpy as np
from scipy.spatial.distance import euclidean
from fastdtw import fastdtw


# t,r 为矩阵
def dtwfast(t, r):
    n = len(t)
    m = len(r)
    x = np.zeros(n)
    y = np.zeros(m)

    for i in range(n):
        x[i] = t[i]

    for j in range(m):
        y[j] = r[j]

    distance, path = fastdtw(x, y, dist=euclidean)
    return distance
